package com.cg.managesystem.service.impl;

import com.cg.managesystem.entity.Room;
import com.cg.managesystem.mapper.RoomMapper;
import com.cg.managesystem.service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created on 2019/8/13 by Tinchi
 **/
@Service
public class RoomServiceImpl implements RoomService {

    @Autowired
    private RoomMapper roomMapper;

    @Override
    public int deleteRoomById(Integer rid) {
        return roomMapper.deleteByPrimaryKey(rid);
    }

    @Override
    public int addRoom(Room room) {
        return roomMapper.insert(room);
    }

    @Override
    public Room findRoomById(Integer rid) {
        return roomMapper.selectByPrimaryKey(rid);
    }

    @Override
    public List<Room> findAllRooms() {
        return roomMapper.selectAll();
    }

    @Override
    public int updateRoomById(Room room) {
        return roomMapper.updateByPrimaryKey(room);
    }
}
